import request from '@/util/request'

// 话题
const Api = {};

// 列表
Api.list = function (params) {
    return request({
        url: 'goods',
        method: 'get',
        params: params,
		loading: false,
    })
}
Api.collect =  function (data) {
    return request({
        url: 'collect',
        method: 'get',
        params: data,
        loading: false,
    })
}

Api.addCollect =  function (data) {
    return request({
        url: 'collect',
        method: 'post',
        data: data,
    })
}
Api.hot = function () {
    return request({
        url: 'goods_hot',
        method: 'get',
    })
}
Api.category = function () {
    return request({
        url: 'category',
        method: 'get',
    })
}

Api.source = function (id) {
    return request({
        url: 'goods_source/' + id,
        method: 'get',
    })
}

Api.scan = function (data) {
    return request({
        url: 'goods_scan',
        method: 'post',
		data:data
    })
}
// 详细
Api.get = function (id) {
    return request({
        url: 'goods/' + id,
        method: 'get',
    })
}

// 新增
Api.add = function (data) {
    return request({
        url: 'goods',
        method: 'post',
        data: data
    })
}

// 修改
Api.update = function (data) {
    return request({
        url: 'goods/' + data.id,
        method: 'post',
        data: data
    })
}

// 删除
Api.del = function (id) {
    return request({
        url: 'goods/' + id,
        method: 'delete',
    })
}
export default Api